﻿using ET.Monitor.DAL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ET.Monitor.Model
{
    public class DistrictModel
    {
        public DistrictModel(string districtId)
        {
            id = districtId;
        }
        string id = "", disParentId, disNameCn;
        public DistrictModel(string disId, string parentId, string nameCn)
        {
            id = disId;
            disParentId = parentId;
            disNameCn = nameCn;
        }
        DistrictDAL dal = new DistrictDAL();

        #region 根据区域编码获取区域信息

        private DataTable dtDistrictInfo;

        public DataTable DtDistrictInfo
        {
            get { return dal.GetDistrictInfoById(id); }
            set { dtDistrictInfo = value; }
        }
        #endregion

        #region 新增区域
        bool addDistrict;

        public bool AddDistrict
        {
            get { return dal.AddDistrictModel(id, disParentId, disNameCn); }
            set { addDistrict = value; }
        }
        #endregion

        #region 删除区域
        bool delDistrict;

        public bool DelDistrict
        {
            get { return dal.DeleteDistrictModelById(id); }
            set { delDistrict = value; }
        }

        #endregion

        #region 修改区域信息
        bool updateDistrict;

        public bool UpdateDistrict
        {
            get { return dal.UpdateDistrict(id, disNameCn); ; }
            set { updateDistrict = value; }
        }
        #endregion

        #region 实时发负荷
        object[] power;

        public object[] Power
        {
            get { return dal.GetDistrictPower(id); }
            set { power = value; }
        }
        #endregion

        #region 实时发电量
        object[] dl;

        public object[] Dl
        {
            get { return dal.GetDistrictRealDl(id); ; }
            set { dl = value; }
        }
        #endregion

        #region 逆变器编码集合
        DataTable dtOrder;

        public DataTable DtOrder
        {
            get { return dal.GetInverterOrder(id); }
            set { dtOrder = value; }
        }
        #endregion

        #region 逆变器信息
        DataTable invertors;

        public DataTable Invertors
        {
            get { return dal.GetInverter(id); }
            set { invertors = value; }
        }

        public DataTable DtDevice
        {
            get
            {
                return dal.GetDevice(id);
            }

            set
            {
                dtDevice = value;
            }
        }
        #endregion

        #region
        DataTable dtDevice;
        #endregion
    }
}
